package generic;

import java.util.Calendar;
import java.util.Date;
import java.util.Formatter;

public class BitTest {

    private static void testTime() {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2114);
        cal.set(2014, 7, 2, 12, 19, 11);
        cal.set(Calendar.MILLISECOND, 999);
        long time = cal.getTimeInMillis();
        
        long value = time << 16 | 0xffff;
        String str = String.format("time %d 0x%x 0x%x %d",time, time, value, value);
        System.out.println(str);
    }
    
    private static void testTime2() {
        for (int i=0; i< 10000; i++) {
            
            long time = System.currentTimeMillis();
            System.out.println(i+ ": time: " + time + " " + new Date(time));
        }

        

    }
    
    /**
     * @param args
     *
     * @author grind
     * @date Feb 18, 2014 11:53:18 AM
     */
    public static void main(String[] args){
        byte tmp = 0;
        tmp |= (0x1 << 0);
        tmp |= (0x1 << 1);
        tmp |= (0x1 << 2);
        tmp |= (0x1 << 3);
        
        System.out.println("the result is " + tmp);
        testTime();
    }

}
